package com.yhk.usercenter.common;

import lombok.Data;

import java.io.Serializable;

/**
 * @version 1.0
 * @Author moresuo
 * @Date 2023/12/11 21:03
 * @注释 通用返回类
 */
@Data
public class BaseResponse<T> implements Serializable {
    private static final long serialVersionUID = -7506108714914421400L;
    private Integer code;
    private T data;
    private String message;
    private String description;

    public BaseResponse(Integer code, T data, String message,String description) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.description=description;
    }
    public BaseResponse(Integer code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(Integer code, T data) {
        this.code = code;
        this.data = data;
        this.message="";
    }
    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(), null, errorCode.getMessage(), errorCode.getDescription());
    }

}
